package so.wy.servicecenter.businessbed.dao.enums;

/**
 * 订单状态
 */
public enum StatusOrderEnum {
    CREATE(4, "创建"),
    FINISH(2, "完成"),
    CLOSE(3, "关闭"),
    PROCESSING(1, "进行中");

    private Integer code;
    private String name;

    StatusOrderEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static StatusOrderEnum codeOf(Integer code) {
        if (code == null) {
            return null;
        }

        StatusOrderEnum[] values = values();
        for (StatusOrderEnum value : values) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static String codeOfDesc(Integer code) {
        StatusOrderEnum value = codeOf(code);

        return value == null ? "" : value.getName();
    }
}